<?php
	session_start();
	function C($name=null,$value=null){
		static $config = array();
		if(is_array($name)){
			$config  = array_merge($config,array_change_key_case($name));
		}
		if(is_string($name)){
			$name = strtolower($name);
			if(!is_null($value)){
				$config[$name]=$value;
				return true;
			}
			return isset($config[$name])?$config[$name]:null;
		}
		if(is_null($name)){
			return $config;
		}
	}
	//加载语言
	function L($name=null,$value=null){
		static $lang = array();
		if(is_array($name)){
			$lang  = array_merge($lang,array_change_key_case($name));
		}
		if(is_string($name)){
			$name = strtolower($name);
			if(!is_null($value)){
				$lang[$name]=$value;
				return true;
			}
			return isset($lang[$name])?$lang[$name]:null;
		}
		if(is_null($name)){
			return $lang;
		}
		
	}
	//fedora   ubuntu
	function p($arg){
		echo "<pre>";
		print_r($arg);
		echo "</pre>";
	}
	function error($msg){
		echo "<div style='border:solid 2px #dcdcdc;padding:20px;width:800px;'>
		$msg
		</div>";
		exit;
	}
	//自动加载类文件
	function __autoload($className){
		if(strlen($className)>7 && substr($className,-7) =="Control"){
			$classFile = PATH_APP.'/control/'.$className.'.php';
		}else{
			$classFile = PATH_HD.'/bin/'.$className.".class.php";
		}
		if(!is_file($classFile)){
			exit($classFile."文件不存在");
		}
		include $classFile;
	}
?>